import wy from '@/utils/axios/wy'

//获取购物车商品信息下拉框
export function getCarsDropDownApi(skuId: string) {
    return wy.request({
        url: `/goods/sku/${skuId}`,
        method: 'get'
    })
}

//获取购物车列表
export function getCartListApi() {
    return wy.request({
        url: '/member/cart',
        method: 'get'
    })
}

//添加购物车
export function addCartApi(data: any) {
    return wy.request({
        url: '/member/cart',
        method: 'post',
        data
    })
}

//删除单购物车商品或选中删除的商品
export function deleteCartApi(data: object) {
    return wy.request({
        url: `/member/cart`,
        method: 'DELETE',
        data
    })
}


//单选
export function selectCartApi(skuId: string, data: object) {
    return wy.request({
        url: `/member/cart/${skuId}`,
        method: 'put',
        data
    })
}

//全选
export function selectAllCartApi(data: object) {
    return wy.request({
        url: `/member/cart/selected`,
        method: 'put',
        data
    })
}


//修改购物车商品数量
export function updateCartApi(skuId: string, data: object) {
    return wy.request({
        url: `/member/cart/${skuId}`,
        method: 'put',
        data
    })
}